home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / programs_-_usrdoc / SVGALIB-.{2E / LRMI-0.5M / MODE3.C < prev    next >
C/C++ Source or Header  |  1999-09-17  |  1KB  |  53 lines

  1. /*
  2. Set mode to VESA mode 3 (80x25 text mode)
  3. */
  4.  
  5. #include <stdio.h>
  6. #include <string.h>
  7. #include <unistd.h>
  8. #include <stdlib.h>
  9. #include <sys/ioctl.h>
  10. #include <sys/kd.h>
  11. #include <sys/stat.h>
  12.  
  13. #include "lrmi.h"
  14.  
  15. void set_vesa_mode(int mode){
  16.     struct LRMI_regs r;
  17.     memset(&r, 0, sizeof(r));
  18.     r.eax = 0x4f02;
  19.         r.ebx = mode;
  20.     if (!LRMI_int(0x10, &r))
  21.         {
  22.         fprintf(stderr, "Can't set video mode (vm86 failure)\n");
  23.         }
  24.     }
  25.  
  26. int main(int argc, char *argv[]){
  27.        int i;
  28.         
  29.  
  30.         if((argc>1)&&(!strcmp(argv[1],"-h"))){
  31.                printf("Usage: mode3 [ modenum [ font ] ]\n"
  32.                        "\n"
  33.                        "uses VESA bios to set video mode to modenum (3 by default)\n"
  34.                        "if font is given, uses setfont to change the screen font\n\n");       
  35.                 return 0;
  36.         };
  37.     if (!LRMI_init())
  38.         return 1;
  39.     ioperm(0, 0x400, 1);
  40.     iopl(3);
  41.         i=3;
  42.         if(argc>1){
  43.                sscanf(argv[1],"%i",&i);
  44.                 if((i<=0))i=3;
  45.         };
  46.     set_vesa_mode(i);
  47.         if(argc>2){
  48.                execlp("setfont",argv[2],NULL);
  49.                 return 1;
  50.         };
  51.     return 0;
  52. }
  53.